package com.clip.action;

import java.io.File;
import java.io.IOException;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import javax.swing.JFileChooser;

import net.sf.jml.Email;
import net.sf.json.JSONArray;
import net.sf.json.JSONObject;

import org.apache.struts2.ServletActionContext;
import org.jdom.Document;
import org.jdom.Element;
import org.jdom.JDOMException;
import org.jdom.input.SAXBuilder;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import sun.misc.BASE64Decoder;
import sun.misc.BASE64Encoder;
import weibo4j.Oauth;
import weibo4j.Users;
import weibo4j.http.AccessToken;
import weibo4j.model.WeiboException;
import weibo4j.util.BareBonesBrowserLaunch;

import com.clip.action.util.CookieAttributeKey;
import com.clip.action.util.SessionAttributeKey;
import com.clip.entity.ClipEvent;
import com.clip.entity.ClipeventPic;
import com.clip.entity.EmailSubscribe;
import com.clip.entity.User;
import com.clip.entity.UserEmail;
import com.clip.entity.Userassina;
import com.clip.entity.Usermobileinfo;
import com.clip.entity.csch.City;
import com.clip.entity.csch.District;
import com.clip.entity.csch.Province;
import com.clip.service.ContactService;
import com.clip.service.EventService;
import com.clip.service.NoticeItemService;
import com.clip.service.UserEmailService;
import com.clip.service.UserRegApplyService;
import com.clip.service.UserRegInvitesService;
import com.clip.service.UserService;
import com.clip.service.UsermobileinfoService;
import com.clip.util.DimensionCodeUtils;
import com.clip.util.Functions;
import com.clip.util.Struts2Utils;
import com.clip.util.ToolsUtils;
import com.clip.util.mobile.HttpResponseXmlAnalyze;
import com.clip.util.mobile.MobileHttpSender;
import com.clip.util.mobile.MobileMsgPattern;
import com.clip.util.verifycode.VerifyCode;
import com.opensymphony.xwork2.ActionSupport;
import com.opensymphony.xwork2.util.URLUtil;
import com.opensymphony.xwork2.validator.validators.EmailValidator;

@Controller
@Scope("prototype")
public class UserAction extends ActionSupport{
	
	private static final long serialVersionUID = 7744823390283253126L;
	
	private final int INVITEFRIENDNOTICE=1;
	private final int ALERTMETHODNOTICE=2;
	
	private final String emailRegex="^([\\w\\-\\.]+)@((\\[([0-9]{1,3}\\.){3}[0-9]{1,3}\\])|(([\\w\\-]+\\.)+)([a-zA-Z]{2,4}))$";
	
	@Autowired
	private UserService userService;
	@Autowired
	private UserEmailService userEmailService;
	@Autowired
	private UserRegInvitesService userRegInvitesService;
	@Autowired
	private UserRegApplyService userRegApplyService;
	@Autowired
	private UsermobileinfoService usermobileinfoService;
	@Autowired
	private NoticeItemService noticeItemService;
	@Autowired
	private ContactService contactService;
	@Autowired
	private EventService eventService;
	
	private int uid;
	private String emailInput;
	private String pwdInput;
	private String pwdInput2;
	private String nameInput;
	private String vcodeInput;
	private String activate;
	private String mobilenum;
	private String codenum;
	private int usertype;
	private int currentpage;
	private int eventid;
	private String code;
	private int sexInput;
	private long birthdayInput;
	private int provinceid;
	private int type;
	private int cityid;
	private String preAddress;
	private String sufAddress;
	private String webSite;
	private String usernameInput;
	private File ccdemisionfile;
	private String ccdemisionfileFileName;
	private String desc;
	private String sinaheadurl;
	private String suffixurl;
	
	private int emailsubscribeid;
	/**
	 * oldPwdInput 原密码
	 * pwdInput 新密码
	 */
	public void modifyPwd(){
		String result="{result:'修改失败',flag:0}";
		HttpServletRequest request=ServletActionContext.getRequest();
		String oldPwdInput=request.getParameter("oldPwdInput");
		if(ToolsUtils.searchEmpty(oldPwdInput,pwdInput,pwdInput2).size()<=0){
			User user=(User) request.getSession().getAttribute(SessionAttributeKey.USER);
			user=userService.getUserByEmail(user.getEmail());
			if(user!=null){
				if(user.getPwd().equals(ToolsUtils.getStringForMD5(oldPwdInput))&&pwdInput.equals(pwdInput2)){
					user.setPwd(ToolsUtils.getStringForMD5(this.pwdInput));
					if(userService.updateUser(user)!=null){
						result="{result:'修改成功',flag:1}";
					}
				}else{
					result="{result:'原密码错误,修改失败.',flag:0}";
				}
			}
		}
		Struts2Utils.renderText(result);
	}
	//判断密码
	public void checkPwd(){
		String result="{result:'密码错误',flag:0}";
		String pwdRegex="^[a-zA-Z0-9][a-zA-Z0-9_-]{5,19}";
		if(ToolsUtils.searchEmpty(pwdInput).size()<=0&&pwdInput.matches(pwdRegex)){
			HttpSession session=ServletActionContext.getRequest().getSession();
			User user=(User) session.getAttribute(SessionAttributeKey.USER);
			user=userService.getUserByEmail(user.getEmail());
			if(user!=null){
				if(user.getPwd().equals(ToolsUtils.getStringForMD5(pwdInput))){
					result="{result:'密码正确',flag:1}";
				}
			}else{
				result="{result:'您需要登录',flag:0}";
			}
		}
		Struts2Utils.renderText(result);
	}
	//判断用户是否登录
	public void checkExistUser(){
		analyzeCode(this.code);
		HttpSession session = ServletActionContext.getRequest().getSession();
		User user = (User)session.getAttribute(SessionAttributeKey.USER);
		long systime=new Date().getTime();
		String result=null;
		if(user!= null){
			boolean flag=usermobileinfoService.isHasBindableMobile(user.getId());
			int temp=flag?1:0;
			boolean isExist=this.noticeItemService.findNotice(this.INVITEFRIENDNOTICE,user);
			String url=(String) session.getAttribute(SessionAttributeKey.USERLOGO_BIG);
			String surl=(String) session.getAttribute(SessionAttributeKey.USERLOGO_SMALL);
			if(url==null||surl==null){
				this.userService.checkUserLogo(false, session);
				url=(String) session.getAttribute(SessionAttributeKey.USERLOGO_BIG);
				surl=(String) session.getAttribute(SessionAttributeKey.USERLOGO_SMALL);
			}
			StringBuffer buffer=new StringBuffer();
			buffer.append("{loginflag:1,email:'");
			buffer.append(user.getEmail());
			buffer.append("',url:'");
			buffer.append(url);
			buffer.append("',surl:'");
			buffer.append(surl);
			buffer.append("',name:'");
			buffer.append(user.getName());
			buffer.append("',systime:'");
			buffer.append(systime);
			buffer.append("',mobilenotice:");
			buffer.append(temp);
			buffer.append(",usertype:");
			buffer.append(user.getUsertype());
			buffer.append(",uid:");
			buffer.append(user.getId());
			buffer.append(",sex:");
			buffer.append(user.getSex());
			buffer.append(",status:");
			buffer.append(user.getStatus());
			if(isExist){
				buffer.append("}");
			}else{
				buffer.append(",invitefriendnotice:0}");
			}
			result=buffer.toString();
		}else{
			HttpServletRequest request=Struts2Utils.getRequest();
			String url=request.getHeader("referer");
			if(url.indexOf("index.html")<0){
				session.setAttribute(SessionAttributeKey.VISITURL,url);
			}
			this.userService.checkUserLogo(false, session);
			String logourl=(String) session.getAttribute(SessionAttributeKey.USERLOGO_SMALL);
			result="{loginflag:0,systime:"+systime+"}";
		}
		Struts2Utils.renderText(result);
	}
	
	private void analyzeCode(String code2) {
		if(code2==null||code2.length()<=0)
			return;
		if(Email.parseStr(code2)!=null){
			
		}else{
			String email=ToolsUtils.decodingForUT(code2);
			if(Email.parseStr(email)!=null){
				User user=this.userService.changeNoneuserStatus(email);
				HttpSession session=Struts2Utils.getSession();
				session.setAttribute(SessionAttributeKey.USER, user);
			}
		}
	}
	/*
	 * 用户登录
	 */
	public void login(){
		JSONObject reObj=new JSONObject();
		if(ToolsUtils.searchEmpty(emailInput,pwdInput).size()<=0){
			User user = userService.getUserByEmail(emailInput);
			if(user!=null&&ToolsUtils.getStringForMD5(pwdInput).equals(user.getPwd())){
				reObj.put("result", 1);
				reObj.put("userstatus", user.getStatus());
				reObj.put("usertype", user.getUsertype());
				if(user.getStatus()==1){
					HttpSession session = ServletActionContext.getRequest().getSession();
					session.setAttribute(SessionAttributeKey.USER, user);
					this.userService.checkUserLogo(false,session);
					BASE64Encoder e = new BASE64Encoder();
					String cookieInfo;
					if(activate!=null&&Boolean.valueOf(activate)){
						cookieInfo = e.encode((user.getEmail()+",auto").getBytes());
					}else{
						cookieInfo = e.encode((user.getEmail()+",no").getBytes());
					}
					Cookie cookie = new Cookie(CookieAttributeKey.COOKIENAME, cookieInfo);
					cookie.setMaxAge(7*24*60*60);
					cookie.setPath("/");
					ServletActionContext.getResponse().addCookie(cookie);
					Cookie cookie2 = new Cookie(CookieAttributeKey.COOKIESINAUID, "");
					cookie2.setMaxAge(7*24*60*60);
					cookie2.setPath("/");
					ServletActionContext.getResponse().addCookie(cookie2);
					String visiturl=(String) session.getAttribute(SessionAttributeKey.VISITURL);
					if(visiturl!=null&&visiturl.length()>0){
						session.removeAttribute(SessionAttributeKey.VISITURL);
						reObj.put("visiturl",visiturl);
					}
				}
			}else{
				reObj.put("result", 0);
				reObj.put("errormsg", "您的密码或账号错误,登录失败！");
			}
		}else{
			reObj.put("result", 0);
			reObj.put("errormsg", "您的密码或账号错误,登录失败！");
		}
		Struts2Utils.renderJson(reObj.toString());
	}
	/*
	 * 用户退出
	 */
	public void logout(){
		HttpServletRequest request= ServletActionContext.getRequest();
		HttpServletResponse response=ServletActionContext.getResponse();
		User user = (User)request.getSession().getAttribute(SessionAttributeKey.USER);
		Cookie[] cookies=request.getCookies(); 
		if(cookies!=null&&user!=null){
			for(int i=0;i<cookies.length;i++){
				if(cookies[i].getName().equals(CookieAttributeKey.COOKIENAME)){
					Cookie removeCookie = new Cookie(CookieAttributeKey.COOKIENAME,new BASE64Encoder().encode((user.getEmail()+",no").getBytes()));
					removeCookie.setPath("/");
					response.addCookie(removeCookie);
				}else if(cookies[i].getName().equals(CookieAttributeKey.COOKIESINAUID)){
					Userassina userassina = (Userassina)request.getSession().getAttribute(SessionAttributeKey.USERASSINA);
					if(userassina!=null){
						Cookie removeCookie2 = new Cookie(CookieAttributeKey.COOKIESINAUID,Functions.base64_encode(userassina.getSinauid()+",no"));
						removeCookie2.setPath("/");
						response.addCookie(removeCookie2);
					}else{
						Cookie removeCookie2 = new Cookie(CookieAttributeKey.COOKIESINAUID,"");
						removeCookie2.setPath("/");
						response.addCookie(removeCookie2);
					}
				}
			}
		}
		request.getSession().removeAttribute(SessionAttributeKey.USER);
		request.getSession().removeAttribute(SessionAttributeKey.USERASSINA);
	}
	/*
	 * 重置密码
	 */
	public void resetPwd(){
		String result="";
		String pwdRegex="^[a-zA-Z0-9][a-zA-Z0-9_-]{5,19}";
		//不为空\密码\正确\合法
		if(ToolsUtils.searchEmpty(pwdInput,pwdInput2).size()<=0&&pwdInput.matches(pwdRegex)&&pwdInput.equals(pwdInput2)){
			result=userService.pwdReset(activate, pwdInput);
		}
		Struts2Utils.renderHtml(result);
	}
	/*
	 * 密码重置授权
	 */
	public void resetPwdAuthorize(){
		String result="{result:'您的链接无效！',flag:'0'}";
		if(ToolsUtils.searchEmpty(activate).size()<=0){
			result=userService.pwdResetAuthorize(activate);
		}
		Struts2Utils.renderHtml(result);
	}
	/*
	 * 提交'密码找回'信息
	 */
	public void forgetPwd(){
		String result="";
		boolean flag = false;
		String verifyCode=(String)ServletActionContext.getRequest().getSession().getAttribute("verifyCode");
		
		if(emailInput==null||!emailInput.matches(emailRegex)){
			result="{result:'邮箱地址不正确',flag:0}";
			flag = true;
		}
		if(nameInput==null){
			result="{result:'请输入姓名',flag:0}";
			flag = true;
		}
		if(vcodeInput==null){
			result="{result:'验证码输入错误',flag:0}";
			flag = true;
		}
		if(!flag){
			vcodeInput=vcodeInput.toLowerCase();
			verifyCode=verifyCode.toLowerCase();
			if(vcodeInput.equals(verifyCode)){
				result = userService.forgetPwd(emailInput, nameInput);
			}else{
				result="{result:'验证码输入错误',flag:0}";
			}
		}
		Struts2Utils.renderHtml(result);
	}
	/*
	 * 激活用户
	 */
	public void activite(){
		String result="{result:'无效的链接',flag:0}";
		if(activate!=null&&activate!=""){
			result = userService.activite(activate);
		}
		Struts2Utils.renderHtml(result);
	}
	
	public void resendActiveEmail(){
		int resultcode=this.userService.resendActiveEmail(this.emailInput,this.pwdInput);
		JSONObject reObj=new JSONObject();
		if (resultcode==1) {
			reObj.put("result", 1);
		} else if(resultcode==2){
			reObj.put("result", 0);
			reObj.put("errormsg", "账号或密码不对");
		} else if(resultcode==3){
			reObj.put("result", 0);
			reObj.put("errormsg", "账号不是有效邮件地址，无法发送激活邮件");
		} else if(resultcode==4){
			reObj.put("result", 0);
			reObj.put("errormsg", "账号已被禁止登录");
		}
		Struts2Utils.renderJson(reObj.toString());
	}
	/*
	 * 注册用户
	 */
	public void register(){
		String json="{result:'注册失败',flag:0}";
		int flag = 0;
		String msg = "";
		HttpServletRequest request = ToolsUtils.getRequest();
		String verifyCode= (String)request.getSession().getAttribute(SessionAttributeKey.VERIFYCODE);
		String pwdRegex="^[a-zA-Z0-9][a-zA-Z0-9_-]{5,20}$";
		if(emailInput==null){
			flag = -1;
			msg = "输入邮箱地址";
		}else if(pwdInput==null){
			flag = -2;
			msg = "输入密码";
		}else if(pwdInput2==null){
			flag = -3;
			msg = "输入密码不一致";
		}else if(nameInput==null){
			flag = -4;
			msg = "输入姓名";
		}else if(vcodeInput==null){
			flag = -5;
			msg = "输入验证码";
		}
		if(flag>=0){
			vcodeInput=vcodeInput.toLowerCase();
			verifyCode=verifyCode.toLowerCase();
			if(vcodeInput.equals(verifyCode)&&emailInput.matches(emailRegex)&&pwdInput.matches(pwdRegex)&&pwdInput.equals(pwdInput2)){
				json = userService.register(emailInput,ToolsUtils.htmlEnCode(nameInput),pwdInput,sexInput,birthdayInput,preAddress,sufAddress);
			}
		}else{
			json="{flag:"+flag+",'result':'"+msg+"'}";
		}
		Struts2Utils.renderHtml(json);
	}
	/**
	 * 接受邀请 时用户注册
	 */
	/*
	public void registerInvite(){
		String json="{result:'注册失败',flag:0}";
		int flag = 0;
		String msg = "";
		HttpServletRequest request = ToolsUtils.getRequest();
		String verifyCode= (String)request.getSession().getAttribute("verifyCode");
		String emailRegex="^[a-z0-9_\\.]+@([a-z0-9][a-z0-9]+\\.){1,4}[a-z]{2,3}";
		String pwdRegex="^[a-zA-Z0-9][a-zA-Z0-9_-]{5,19}";
		String nameRegex="^[A-Za-z0-9\u4e00-\u9fa5]{2,20}";
		String vcodeRegex="[A-Za-z0-9]{4,4}";
		if(activate==null){
			flag = -6;
			msg = "你没有被邀请";
		}else if(emailInput==null){
			flag = -1;
			msg = "输入邮箱地址";
		}else if(pwdInput==null){
			flag = -2;
			msg = "输入密码";
		}else if(pwdInput2==null){
			flag = -3;
			msg = "输入密码不一致";
		}else if(nameInput==null){
			flag = -4;
			msg = "输入姓名";
		}else if(vcodeInput==null){
			flag = -5;
			msg = "输入验证码";
		}
		if(flag>=0){
			if(emailInput.matches(emailRegex)&&pwdInput.matches(pwdRegex)&&nameInput.matches(nameRegex)&&vcodeInput.matches(vcodeRegex)&&pwdInput.equals(pwdInput2)){
				vcodeInput=vcodeInput.toLowerCase();
				verifyCode=verifyCode.toLowerCase();
				if(vcodeInput.equals(verifyCode)){
					json="{flag:0,'result':'此邀请无效'}";
					UserRegInvites uri = userRegInvitesService.findUserRegInvitesByCode(activate);
					if(uri!=null){
						if(uri.getStatus()==0){
							UserRegApply userRegApply = userRegApplyService.findUserRegApplyById(uri.getReguid());
							if(userRegApply!=null){
								User user = new User();
								user.setBirth(userRegApply.getBirth());
								user.setBlog(userRegApply.getBlog());
								user.setEdu(userRegApply.getEdu());
								user.setEmail(userRegApply.getEmail());
								user.setJob(userRegApply.getJob());
								user.setLiving(userRegApply.getLiving());
								user.setName(userRegApply.getName());
								user.setPwd(ToolsUtils.getStringForMD5(pwdInput));
								user.setSex(userRegApply.getSex());
								user.setStatus(1);
								json = userService.register1(user,uri);
							}
						}
					}
//					json = userService.register(emailInput,nameInput,pwdInput);
				}else{
					json="{flag:0,result:'验证码错误'}";
				}
			}
		}else{
			json="{flag:"+flag+",result:'"+msg+"'}";
		}
		Struts2Utils.renderText(json);
	}*/
	/*
	 * 验证"验证码"
	 */
	public void checkYzm(){
		String result="0";
		String verifyCode=(String)ServletActionContext.getRequest().getSession().getAttribute(SessionAttributeKey.VERIFYCODE);
		if(vcodeInput!=null&&verifyCode!=null&&verifyCode!=""&&vcodeInput!=""){
			vcodeInput=vcodeInput.toLowerCase();
			verifyCode=verifyCode.toLowerCase();
			if(vcodeInput.equals(verifyCode)){
				result="1";
			}
		}
		Struts2Utils.renderHtml(result);
	}
	/*
	 * 验证Email 是否存在
	 */
	public void checkUser(){
		String result="0";
		
//		User user = userService.getUserByEmail(emailInput);
		UserEmail userEmail = userEmailService.getUserEmailByEmail(emailInput);
		
		if(userEmail==null)
			result="1";
		else
			result="0";
		
		Struts2Utils.renderText(result);
	}
	
	public void checkCCUser(){
		boolean isexist=userService.checkCCUsername(emailInput);
		JSONObject jsonObject=new JSONObject();
		jsonObject.put("result", isexist?0:1);
		Struts2Utils.renderJson(jsonObject.toString());
	}
	
	public void searchUserByName(){
		HttpServletRequest request= ServletActionContext.getRequest();
		User crtuser = (User)request.getSession().getAttribute(SessionAttributeKey.USER);
		String nameRegex="^[A-Za-z0-9\u4e00-\u9fa5]{1,20}";
		if(nameInput.matches(nameRegex)){
			List<User> users=this.userService.searchUserByName(nameInput,crtuser,this.usertype);
			if(this.usertype==1){
				Map<String, Map> returnMap=new LinkedHashMap<String, Map>();
				for (User user : users) {
					Map<String,Object> temp2=new HashMap<String,Object>();
					temp2.put("name", user.getName());
					temp2.put("email", user.getEmail());
					//temp2.put("birth", ""+user.getBirth());
					//temp2.put("sex", user.getSex()==null?"":user.getSex());
					//temp2.put("living", user.getLiving()==null?"":user.getLiving());
					boolean flag=this.userService.checkHasRelationship(crtuser.getId(),user.getId());
					String biglogo=(String) UserService.getUserLogoByUid(user.getId()).get(0);
					temp2.put("ulogo",ToolsUtils.xmlCDATA(biglogo));
					temp2.put("isfriend", flag);
					returnMap.put("User uid="+user.getId(), temp2);
				}
				Struts2Utils.renderXml(ToolsUtils.getDOM(returnMap));
			}else if(this.usertype==2){
				Map<String, Map> returnMap=new LinkedHashMap<String, Map>();
				for (User user : users) {
					Map<String,Object> temp2=new HashMap<String,Object>();
					temp2.put("name", user.getName());
					temp2.put("job", user.getJob());
					boolean isSubcribe=this.userService.checkIsSubscribed(crtuser.getId(),user.getId());
					String biglogo=(String) UserService.getUserLogoByUid(user.getId()).get(0);
					temp2.put("ulogo",ToolsUtils.xmlCDATA(biglogo));
					temp2.put("isSubcribe", isSubcribe);
					temp2.put("subscribedcount", this.contactService.countAllSubscribedUsers(user.getId(),true));
					returnMap.put("User uid="+user.getId(), temp2);
				}
				Struts2Utils.renderXml(ToolsUtils.getDOM(returnMap));
			}
		}else{
			Struts2Utils.renderText("");
		}
	}
	
	public void sendVerCode(){
		HttpSession session=Struts2Utils.getSession();
		User user=(User) session.getAttribute(SessionAttributeKey.USER);
		if(user==null){
			Struts2Utils.renderText("{flag:0,result:'对不起，您可能还未激活账户或未登录网站。'}");
			return;
		}else{
			boolean flag=this.usermobileinfoService.isMobileBindable(mobilenum);
			if(flag){
				Struts2Utils.renderText("{flag:0,result:'对不起，您的账户已绑定手机。'}");
				return;
			}else{
				Map vermap=(Map) session.getAttribute(SessionAttributeKey.VERCODE);
				
				if(vermap==null){
					vermap=new HashMap();
					Date date=new Date();
					vermap.put("lasttime", date.getTime());
					String validatenum=VerifyCode.getValidateNumber();
					vermap.put("mobilenum", this.mobilenum);
					vermap.put("code", validatenum);
					session.setAttribute(SessionAttributeKey.VERCODE,vermap);
					sendMobileMsg(user.getName(),validatenum);
				}else{
					Calendar now=Calendar.getInstance();
					Calendar temp=(Calendar) now.clone();
					Long lasttime=(Long) vermap.get("lasttime");
					temp.setTimeInMillis(lasttime);
					temp.add(Calendar.MINUTE, 1);
					if(temp.getTimeInMillis()>now.getTimeInMillis()){
						Struts2Utils.renderText("{flag:0,result:'对不起，请勿频繁请求手机验证码，每隔2分钟请求一次。'}");
						return;
					}else{
						String validatenum=VerifyCode.getValidateNumber();
						vermap.put("lasttime", now.getTimeInMillis());
						vermap.put("mobilenum", this.mobilenum);
						vermap.put("code", validatenum);
						session.setAttribute(SessionAttributeKey.VERCODE,vermap);
						sendMobileMsg(user.getName(),validatenum);
					}
					
				}
			}
		}
	}
	
	public void verifyCode(){
		HttpSession session=Struts2Utils.getSession();
		User user=(User) session.getAttribute(SessionAttributeKey.USER);
		if(user==null){
			Struts2Utils.renderText("{flag:0,result:'对不起，您可能还未激活账号或未登录网站。'}");
			return;
		}else{
			boolean flag=this.usermobileinfoService.isMobileBindable(mobilenum);
			if(flag){
				Struts2Utils.renderText("{flag:0,result:'对不起，该手机号已被使用，一个手机号只能绑定在一个账户上。'}");
				return;
			}else{
				if(this.usermobileinfoService.isHasBindableMobile(user.getId())){
					Struts2Utils.renderText("{flag:0,result:'对不起，您的账户上已经绑定了手机。'}");
					return;
				}
				Map vermap=(Map) session.getAttribute(SessionAttributeKey.VERCODE);
				if(vermap==null){
					Struts2Utils.renderText("{flag:0,result:'对不起，您还未请求新的验证码发送给您的手机。'}");
					return;
				}else{
					Calendar now=Calendar.getInstance();
					String code=(String) vermap.get("code");
					String mobilenum=(String) vermap.get("mobilenum");
					if(code.equals(this.codenum)){
						Long lasttime=(Long) vermap.get("lasttime");
						Calendar lastsend=Calendar.getInstance();
						lastsend.setTimeInMillis(lasttime);
						lastsend.add(Calendar.MINUTE, 10);
						if(lastsend.getTimeInMillis()>=now.getTimeInMillis()){
							this.usermobileinfoService.bindMobileWithUser(mobilenum,user);
							Struts2Utils.renderText("{flag:1,result:'验证成功，您的手机号已绑定在您的账号上。'}");
						}else{
							session.removeAttribute(SessionAttributeKey.VERCODE);
							Struts2Utils.renderText("{flag:0,result:'对不起，您输入的验证码超时，请在10分钟内验证。'}");
						}
					}else{
						Struts2Utils.renderText("{flag:0,result:'对不起，请输入正确的验证码或重新发送新的验证码给您的手机。'}");
					}
				}
			}
		}
	}
	
	public void sendVerCodeAndReset(){
		HttpSession session=Struts2Utils.getSession();
		User user=(User) session.getAttribute(SessionAttributeKey.USER);
		if(user==null){
			Struts2Utils.renderText("{flag:0,result:'对不起，您可能还未激活账号或未登录网站。'}");
			return;
		}else{
			boolean flag=this.usermobileinfoService.isMobileBindable(mobilenum);
			if(flag){
				Struts2Utils.renderText("{flag:0,result:'对不起，该手机号已被使用，一个手机号只能绑定在一个账户上。'}");
				return;
			}else{
				this.usermobileinfoService.resetBindableMobile(user.getId());
				Map vermap=(Map) session.getAttribute(SessionAttributeKey.VERCODE);
				if(vermap==null){
					vermap=new HashMap();
					Date date=new Date();
					vermap.put("lasttime", date.getTime());
					String validatenum=VerifyCode.getValidateNumber();
					vermap.put("mobilenum", this.mobilenum);
					vermap.put("code", validatenum);
					session.setAttribute(SessionAttributeKey.VERCODE,vermap);
					sendMobileMsg(user.getName(),validatenum);
					return;
				}else{
					Calendar now=Calendar.getInstance();
					Calendar temp=(Calendar) now.clone();
					Long lasttime=(Long) vermap.get("lasttime");
					temp.setTimeInMillis(lasttime);
					temp.add(Calendar.MINUTE, 1);
					if(temp.getTimeInMillis()>now.getTimeInMillis()){
						Struts2Utils.renderText("{flag:0,result:'对不起，60秒内请勿多次请求手机验证码。'}");
						return;
					}else{
						vermap.put("lasttime", now.getTimeInMillis());
						vermap.put("mobilenum", this.mobilenum);
						session.setAttribute(SessionAttributeKey.VERCODE,vermap);
						String validatenum=VerifyCode.getValidateNumber();
						sendMobileMsg(user.getName(),validatenum);
					}
				}
			}
		}
	}
	
	public void isHasBindableMobile(){
		HttpSession session=Struts2Utils.getSession();
		User user=(User) session.getAttribute(SessionAttributeKey.USER);
		boolean isExist=this.noticeItemService.findNotice(this.ALERTMETHODNOTICE,user);
		
		boolean flag=this.usermobileinfoService.isHasBindableMobile(user.getId());
		int temp=flag?1:0;
		int temp2=isExist?1:0;
		Struts2Utils.renderText("{flag:"+temp+",alertmethodnotice:"+temp2+"}");
	}
	
	private void sendMobileMsg(String name,String validatenum){
		String content=MobileHttpSender.sendMobileMsg(this.mobilenum, MobileMsgPattern.getMobileBundlingMsg(name, validatenum));
		int result=HttpResponseXmlAnalyze.getSendResult(content);
		switch (result) {
			case 0:
				Struts2Utils.renderText("{flag:1,result:'发送成功，验证码已以短消息形式发送至您的手机。（验证码10分钟后过期）'}");
				break;
			case 1:
				Struts2Utils.renderText("{flag:0,result:'发送失败，您的手机号码格式不正确。'}");
				break;
			case 11:
				Struts2Utils.renderText("{flag:0,result:'发送失败，您的短信内容包含非法字词。'}");
				break;
			default:
				Struts2Utils.renderText("{flag:0,result:'发送失败，系统发生错误。'}");
				break;
		}
	}
	
	public void cancelInviteFriendNotice(){
		HttpSession session=Struts2Utils.getSession();
		User user=(User) session.getAttribute(SessionAttributeKey.USER);
		this.noticeItemService.createObject(user,this.INVITEFRIENDNOTICE,"具有MSN导入、邮箱邀请、好友搜索功能");
		Struts2Utils.renderText("{flag:1}");
	}
	
	
	public void cancelAlertMethodNotice(){
		HttpSession session=Struts2Utils.getSession();
		User user=(User) session.getAttribute(SessionAttributeKey.USER);
		this.noticeItemService.createObject(user,this.ALERTMETHODNOTICE,"您可以设置提醒时间，来记住重要的日子哦");
		Struts2Utils.renderText("{flag:1}");
	}
	
	public void loadUserBaseInfo(){
		HttpSession session=Struts2Utils.getSession();
		User currentUser=(User) session.getAttribute(SessionAttributeKey.USER);
		User visitUser=this.userService.getUserById(uid);
		SimpleDateFormat dateFormat=new SimpleDateFormat("yyyy.MM.dd");
		JSONObject jsonObject=new JSONObject();
		if(visitUser.getUsertype()==1){
			if(currentUser==null||currentUser.getStatus()!=1){
				jsonObject.put("result", 0);
				jsonObject.put("errormsg", "无权访问该页面");
				Struts2Utils.renderJson(jsonObject.toString());
				return;
			}
			jsonObject.put("result", 1);
			if(currentUser.getId()==visitUser.getId()){
				jsonObject.put("usertype",visitUser.getUsertype());
				jsonObject.put("isuserself", true);
				jsonObject.put("realname", currentUser.getName());
				jsonObject.put("email", currentUser.getEmail());
				jsonObject.put("mobile", usermobileinfoService.getBindableMobile(currentUser.getId()));
				if(currentUser.getBirth()!=null&&currentUser.getBirth()>0l){
					Date date=new Date();
					date.setTime(currentUser.getBirth());
					jsonObject.put("birth", dateFormat.format(date));
				}else
					jsonObject.put("birth","");
				List templist=this.userService.getUserLogoByUid(currentUser.getId());
				jsonObject.put("userlogo",templist.get(0));
				jsonObject.put("smalluserlogo",templist.get(1));
				jsonObject.put("userid",0);
				jsonObject.put("sex",currentUser.getSex());
			}else{
				jsonObject.put("isuserself", false);
				jsonObject.put("name",this.contactService.getUserName(currentUser.getId(),visitUser.getId()));
				int usertype=currentUser.getUsertype();
				boolean isfriend=this.contactService.judgeRelation(visitUser, currentUser);
				boolean hasinvite=false;
				if(usertype==2){
					jsonObject.put("realname", visitUser.getName());
					jsonObject.put("email", visitUser.getEmail());
					jsonObject.put("mobile", usermobileinfoService.getBindableMobile(visitUser.getId()));
					if(visitUser.getBirth()!=null&&visitUser.getBirth()>0l){
						Date date=new Date();
						date.setTime(visitUser.getBirth());
						jsonObject.put("birth", dateFormat.format(date));
					}else
						jsonObject.put("birth","");
				}else{
					
					if(!isfriend){
						hasinvite=this.contactService.judgeHasInvited(visitUser, currentUser);
					}else{
						jsonObject.put("realname", visitUser.getName());
						jsonObject.put("email", visitUser.getEmail());
						jsonObject.put("mobile", usermobileinfoService.getBindableMobile(visitUser.getId()));
						if(visitUser.getBirth()!=null&&visitUser.getBirth()>0l){
							Date date=new Date();
							date.setTime(visitUser.getBirth());
							jsonObject.put("birth", dateFormat.format(date));
						}else
							jsonObject.put("birth","");
					}
				}
				
				jsonObject.put("usertype",visitUser.getUsertype());
				
				jsonObject.put("relation", isfriend);
				jsonObject.put("hasinvite", hasinvite);
				List templist=this.userService.getUserLogoByUid(visitUser.getId());
				jsonObject.put("userlogo",templist.get(0));
				jsonObject.put("smalluserlogo",templist.get(1));
				jsonObject.put("userid",visitUser.getId());
				jsonObject.put("sex",visitUser.getSex());
			}
		}else if(visitUser.getUsertype()==2){
			boolean ishas=this.userService.checkIsHaspermission(currentUser,visitUser);
			if(ishas){
				jsonObject.put("result", 1);
				String address=visitUser.getLiving();
				if(address==null||address.length()<=0){
					jsonObject.put("address", "");
				}else{
					if(address.indexOf(":")>0){
						String []addarr=address.split(":");
						String preaddress=addarr[0];
						String sufaddress=addarr[1];
						if(preaddress.indexOf("_")>0){
							String[]areaarr=preaddress.split("_");
							int pid=Integer.parseInt(areaarr[0]);
							String padd=UserService.getRealAddress("Province",pid);
							int cid=Integer.parseInt(areaarr[1]);
							String cadd=null;
							String dadd=null;
							if(cid==0){
								cadd="";
							}else{
								cadd=UserService.getRealAddress("City",cid);
							}
							if(areaarr.length==3){
								int did=Integer.parseInt(areaarr[2]);
								if(did==0){
									dadd="";
								}else{
									dadd=UserService.getRealAddress("District", did);
								}
							}else{
								dadd="";
							}
							jsonObject.put("address", padd+cadd+dadd+" "+sufaddress);
						}else{
							int pid=Integer.parseInt(preaddress);
							String padd=UserService.getRealAddress("Province",pid);
							if(padd==null){
								jsonObject.put("address", sufaddress);
							}else{
								jsonObject.put("address", padd+" "+sufaddress);
							}
						}
						
					}else{
						jsonObject.put("address", address);
					}
				}
				jsonObject.put("usertype",visitUser.getUsertype());
				jsonObject.put("name", visitUser.getName());
				jsonObject.put("blog", visitUser.getBlog());
				jsonObject.put("bgurl", visitUser.getBgurl());
				jsonObject.put("desc", visitUser.getJob());
				List templist=this.userService.getUserLogoByUid(visitUser.getId());
				if(visitUser.getEdu()!=null&&visitUser.getEdu().length()>0){
					String url=this.userService.getCCDemensionByUid(visitUser.getId());
					jsonObject.put("dimensioncodeurl",url);
				}else{
					jsonObject.put("dimensioncodeurl","");
				}
				jsonObject.put("userlogo",templist.get(0));
				jsonObject.put("smalluserlogo",templist.get(1));
				if(currentUser!=null&&currentUser.getStatus()==1)
					jsonObject.put("issubsribed", this.userService.checkIsSubscribed(currentUser.getId(),visitUser.getId()));
				jsonObject.put("subscribedcount", this.contactService.countAllSubscribedUsers(visitUser.getId(),true));
				jsonObject.put("userid",visitUser.getId());
				jsonObject.put("sex",visitUser.getSex());
			}else{
				jsonObject.put("result", 0);
				jsonObject.put("errormsg", "无权访问该页面");
				Struts2Utils.renderJson(jsonObject.toString());
				return;
			}
		}
		Struts2Utils.renderJson(jsonObject.toString());
	}
	
	public void checkHasContacts(){
		HttpSession session=Struts2Utils.getSession();
		User currentUser=(User) session.getAttribute(SessionAttributeKey.USER);
		long counthas=this.contactService.getUserContactTotalCount(currentUser,1);
		if(counthas>0l){
			Struts2Utils.renderText("{flag:1}");
		}else{
			Struts2Utils.renderText("{flag:0}");
		}
	}
	
	public void loadUserSubscribed(){
		HttpSession session=Struts2Utils.getSession();
		User currentUser=(User) session.getAttribute(SessionAttributeKey.USER);
		long count=this.userService.countUserSubscribed(currentUser.getId());
		List list=this.userService.getUserSubscribed(currentUser.getId(),this.currentpage);
		BigDecimal br = new BigDecimal(count).divide(new BigDecimal(UserService.USERSUBSCRIBELENGTH),BigDecimal.ROUND_UP);
		Integer pageCount = (br.doubleValue()<1&&br.doubleValue()>=0 ? 1 : br.intValue());
		Map returnMap=new LinkedHashMap();
		for (Object object : list) {
			Map smallmap=new HashMap();
			User user=(User) object;
			List headlist=this.userService.getUserLogoByUid(user.getId());
			smallmap.put("name",user.getName());
			smallmap.put("smalllogo", ToolsUtils.xmlCDATA(headlist.get(1)));
			smallmap.put("subscribedcount", this.contactService.countAllSubscribedUsers(user.getId(),true));
			returnMap.put("User id="+user.getId(), smallmap);
		}
		returnMap.put("pagecount", pageCount);
		returnMap.put("currentpage", currentpage);
		Struts2Utils.renderXml(ToolsUtils.getDOM(returnMap));
	}
	
	public void loadUserAllSubscribed(){
		HttpSession session=Struts2Utils.getSession();
		User currentUser=(User) session.getAttribute(SessionAttributeKey.USER);
		List list=this.userService.getUserAllSubscribed(currentUser.getId());
		Map returnMap=new LinkedHashMap();
		for (Object object : list) {
			Map smallmap=new HashMap();
			User user=(User) object;
			smallmap.put("name",user.getName());
			returnMap.put("User id="+user.getId(), smallmap);
		}
		Struts2Utils.renderXml(ToolsUtils.getDOM(returnMap));
	}
	
	public void loadAllsubscribed(){
		HttpSession session=Struts2Utils.getSession();
		User currentUser=(User) session.getAttribute(SessionAttributeKey.USER);
		boolean islogin=currentUser!=null&&currentUser.getStatus()==1;
		long count=this.userService.countAllsubscribes();
		List list=this.userService.getAllsubscribes(this.currentpage);
		BigDecimal br = new BigDecimal(count).divide(new BigDecimal(UserService.USERUNSUBSCRIBELENGTH),BigDecimal.ROUND_UP);
		Integer pageCount = (br.doubleValue()<1&&br.doubleValue()>=0 ? 1 : br.intValue());
		Map returnMap=new LinkedHashMap();
		for (Object object : list) {
			Map smallmap=new HashMap();
			User user=(User) object;
			List headlist=this.userService.getUserLogoByUid(user.getId());
			smallmap.put("name",user.getName());
			smallmap.put("desc", user.getJob());
			smallmap.put("biglogo",ToolsUtils.xmlCDATA(headlist.get(0)));
			if(islogin)
				smallmap.put("issubscribed", this.userService.checkIsSubscribed(currentUser.getId(), user.getId()));
			smallmap.put("subscribedcount", this.contactService.countAllSubscribedUsers(user.getId(),true));
			returnMap.put("User id="+user.getId(), smallmap);
		}
		returnMap.put("pagecount", pageCount);
		returnMap.put("currentpage", currentpage);
		Struts2Utils.renderXml(ToolsUtils.getDOM(returnMap));
	}
	
	public void submitNoneuserInfo(){
		JSONObject jsonObject=new JSONObject();
		if(this.emailInput.matches(emailRegex)){
			User noneUser=this.userService.submitNoneuserInfo(this.nameInput,this.emailInput);
			if(noneUser!=null){
				Struts2Utils.getSession().setAttribute(SessionAttributeKey.USER, noneUser);
				this.userEmailService.checkAndSendNoneuserClipEmail(noneUser,this.eventid);
				ClipEvent clipEvent=this.eventService.getDetailClipEvent(eventid);
				List<Long> checklist=this.eventService.checkUserStatusAboutShareEvent(clipEvent,noneUser);
				jsonObject.put("userisinterested",checklist.get(0)>0l?true:false);
				if(checklist.size()>1)
					jsonObject.put("userisfavor",checklist.get(1)>0l?true:false);
				if(checklist.get(0)>0l){//表明已经感兴趣
					jsonObject.put("clocktime", clipEvent.getAlerttime());
				}
				jsonObject.put("result", 1);
				jsonObject.put("noneuid", noneUser.getId());
				jsonObject.put("userstatus", noneUser.getStatus());
			}else{
				jsonObject.put("result", 0);
				jsonObject.put("errormsg", "邮箱地址已被占用");
			}
		}else{
			jsonObject.put("result", 0);
			jsonObject.put("errormsg", "请输入正确的邮箱地址");
		}
		Struts2Utils.renderJson(jsonObject.toString());
	}
	
	public void activateUser(){
		JSONObject returnJson=new JSONObject();
		HttpSession session=Struts2Utils.getSession();
		User currentUser=(User) session.getAttribute(SessionAttributeKey.USER);
		if(currentUser.getUsertype()!=3){
			returnJson.put("result", 0);
			returnJson.put("msg", "用户类型不匹配");
		}else{
			if(currentUser.getStatus()!=1){
				returnJson.put("result",0);
				returnJson.put("msg", "邮箱需要激活，我们已将激活邮件发送至您的注册邮箱");
			}else{
				String verifyCode= (String)session.getAttribute(SessionAttributeKey.VERIFYCODE);
				if(verifyCode.equals(this.vcodeInput)){
					returnJson.put("result", 1);
					currentUser.setName(this.nameInput);
					currentUser.setBirth(this.birthdayInput);
					currentUser.setSex(this.sexInput);
					currentUser.setUsertype(1);
					this.userService.activateUser(currentUser);
					returnJson.put("result", 1);
				}else{
					returnJson.put("result", 0);
					returnJson.put("msg", "验证码输入错误");
				}
			}
		}
		Struts2Utils.renderJson(returnJson.toString());
	}
	
	public void submitNoneuserInterest(){
		if(this.emailsubscribeid>0){
			EmailSubscribe emailSubscribe=this.contactService.getEmailSubscribe(this.emailsubscribeid);
			this.userService.submitNoneuserInterest(emailSubscribe.getEmail(),this.eventid);
		}else
			this.userService.submitNoneuserInterest(this.emailInput,this.eventid);
		JSONObject returnJson=new JSONObject();
		returnJson.put("result", 1);
		Struts2Utils.renderJson(returnJson.toString());
	}
	
	public void loadAllProvinces(){
		JSONObject jsonObject=new JSONObject();
		JSONArray array=new JSONArray();
		Province province=new Province();
		SAXBuilder builder=new SAXBuilder(false);
		try {
			Document document=builder.build(province.getProvinceFilepath());   
			Element es=document.getRootElement();
			List rowlist=es.getChildren("row");
			for(int i=0;i<rowlist.size();i++){
				JSONObject temp=new JSONObject();
				Element element=(Element) rowlist.get(i);
				temp.put(Province.ID,element.getChildText(Province.ID) );
				temp.put(Province.NAME,element.getChildText(Province.NAME) );
				temp.put(Province.TYPE,element.getChildText(Province.TYPE) );
				array.add(temp);
			}
			jsonObject.put("result", 1);
			jsonObject.put("provinces", array);
		} catch (JDOMException e) {
			jsonObject=new JSONObject();
			jsonObject.put("result", 0);
			e.printStackTrace();
		} catch (IOException e) {
			jsonObject=new JSONObject();
			jsonObject.put("result", 0);
			e.printStackTrace();
		}finally{
			Struts2Utils.renderJson(jsonObject.toString());
		}
	}
	
	public void loadCityByProvinceid(){
		//provinceid type
		JSONObject jsonObject=new JSONObject();
		JSONArray array=new JSONArray();
		City city=new City();
		SAXBuilder builder=new SAXBuilder(false);
		try {
			Document document=builder.build(city.getCityFilepath());   
			Element es=document.getRootElement();
			List rowlist=es.getChildren("row");
			for(int i=0;i<rowlist.size();i++){
				JSONObject temp=new JSONObject();
				Element element=(Element) rowlist.get(i);
				Integer pid=Integer.parseInt(element.getChildText(City.PID));
				if(pid==provinceid){
					temp.put(City.ID,element.getChildText(City.ID) );
					temp.put(City.NAME,element.getChildText(City.NAME) );
					temp.put(City.TYPE,element.getChildText(City.TYPE) );
					array.add(temp);
				}
			}
			jsonObject.put("result", 1);
			jsonObject.put("cities", array);
		} catch (JDOMException e) {
			jsonObject=new JSONObject();
			jsonObject.put("result", 0);
			e.printStackTrace();
		} catch (IOException e) {
			jsonObject=new JSONObject();
			jsonObject.put("result", 0);
			e.printStackTrace();
		}finally{
			Struts2Utils.renderJson(jsonObject.toString());
		}
	}
	
	public void loadDistrict(){
		JSONObject jsonObject=new JSONObject();
		JSONArray array=new JSONArray();
		District district=new District();
		SAXBuilder builder=new SAXBuilder(false);
		try {
			Document document=builder.build(district.getDistrictFilepath());   
			Element es=document.getRootElement();
			List rowlist=es.getChildren("row");
			for(int i=0;i<rowlist.size();i++){
				JSONObject temp=new JSONObject();
				Element element=(Element) rowlist.get(i);
				Integer pid=Integer.parseInt(element.getChildText(District.PID));
				Integer ppid=Integer.parseInt(element.getChildText(District.PPID));
				if(ppid==provinceid&&pid==cityid){
					temp.put(District.ID,element.getChildText(District.ID) );
					temp.put(District.NAME,element.getChildText(District.NAME) );
					temp.put(District.TYPE,element.getChildText(District.TYPE) );
					array.add(temp);
				}
			}
			jsonObject.put("result", 1);
			jsonObject.put("districts", array);
		} catch (JDOMException e) {
			jsonObject=new JSONObject();
			jsonObject.put("result", 0);
			e.printStackTrace();
		} catch (IOException e) {
			jsonObject=new JSONObject();
			jsonObject.put("result", 0);
			e.printStackTrace();
		}finally{
			Struts2Utils.renderJson(jsonObject.toString());
		}
	}
	
	public void settle(){
		JSONObject returnObj=new JSONObject();
		int flag = 0;
		String msg = "";
		HttpServletRequest request = ToolsUtils.getRequest();
		String verifyCode= (String)request.getSession().getAttribute(SessionAttributeKey.VERIFYCODE);
		String pwdRegex="^[a-zA-Z0-9][a-zA-Z0-9_-]{5,20}$";
		
		if(usernameInput==null||usernameInput.length()<=0){
			returnObj.put("result", 0);
			returnObj.put("msg", "请输入登录名");
			
		}else if(pwdInput==null||pwdInput.length()<=0){
			returnObj.put("result", 0);
			returnObj.put("msg", "请输入密码");
			
		}else if(pwdInput2==null||pwdInput2.length()<=0){
			returnObj.put("result", 0);
			returnObj.put("msg", "请输入重复密码");
			
		}else if(nameInput ==null||nameInput.length()<=0){
			returnObj.put("result", 0);
			returnObj.put("msg", "请输入商家名称");
			
		}else if(vcodeInput ==null||vcodeInput.length()<=0){
			returnObj.put("result", 0);
			returnObj.put("msg", "请输入验证码");
			
		}else if(emailInput ==null||emailInput.length()<=0){
			returnObj.put("result", 0);
			returnObj.put("msg", "请输入邮箱地址");
			
		}else if(!pwdInput.matches(pwdRegex)){
			returnObj.put("result", 0);
			returnObj.put("msg", "数字、英文、下划线及中杠线5到20位的密码");
		}else if(!pwdInput.equals(pwdInput2)){
			returnObj.put("result", 0);
			returnObj.put("msg", "两次密码输入不一致");
		}else if(Email.parseStr(emailInput)==null){
			returnObj.put("result", 0);
			returnObj.put("msg", "请输入正确的邮箱地址");
		}else{
			vcodeInput=vcodeInput.toLowerCase();
			verifyCode=verifyCode.toLowerCase();
			if(!vcodeInput.equals(verifyCode)){
				returnObj.put("result", 0);
				returnObj.put("msg", "验证码输入错误");
			}else{
				msg=userService.settle(usernameInput,ToolsUtils.htmlEnCode(nameInput),pwdInput,emailInput,webSite,preAddress,sufAddress);
				if(msg!=null&&msg.length()>0){
					returnObj.put("result", 0);
					returnObj.put("msg",msg);
				}else{
					returnObj.put("result", 1);
				}
			}
		}
		Struts2Utils.renderJson(returnObj.toString());
	}
	
	public void uploadDemisionCode(){
		HttpSession session=Struts2Utils.getSession();
		User currentUser=(User) session.getAttribute(SessionAttributeKey.USER);
		int usertype=currentUser.getUsertype();
		if(ccdemisionfile!=null){
			long filelength=ccdemisionfile.length();
			double re=(new BigDecimal(filelength).divide(new BigDecimal(1024)).divide(new BigDecimal(1024)).doubleValue());
			if(re>2.0d){
				Struts2Utils.renderHtml("<script>parent.errorUploadCallback('上传的二维码文件不能大于2M')</script>");
				return;
			}
		}
		if(DimensionCodeUtils.decode(ccdemisionfile)==null){
			Struts2Utils.renderHtml("<script>parent.errorUploadCallback('请上传正确的二维码文件')</script>");
			return;
		}
		User user=this.userService.saveDemisionCode(currentUser.getId(),this.ccdemisionfile,this.ccdemisionfileFileName);
		session.setAttribute(SessionAttributeKey.USER,user);
		String url=this.userService.getCCDemensionByUid(user.getId());
		Struts2Utils.renderHtml("<script>parent.demensionUploadCallback('"+url+"')</script>");
		
	}

	public void getCCUserInfo(){
		HttpSession session=Struts2Utils.getSession();
		User currentUser=(User) session.getAttribute(SessionAttributeKey.USER);
		JSONObject jsonObject=new JSONObject();
		if(currentUser.getUsertype()==2){
			String username=currentUser.getEmail();
			String name=currentUser.getName();
			String address=currentUser.getLiving();
			String desc=currentUser.getJob();
			String website=currentUser.getBlog();
			String demensioncode=this.userService.getCCDemensionByUid(currentUser.getId());
			List emails=this.userEmailService.getUserEmailbyUid(currentUser.getId());
			jsonObject.put("result", 1);
			if(demensioncode.indexOf(currentUser.getId())<0){
				jsonObject.put("hasdemension", 0);
			}else{
				jsonObject.put("hasdemension", 1);
			}
			jsonObject.put("demensioncodeurl", demensioncode);
			jsonObject.put("username", username);
			jsonObject.put("name", name);
			jsonObject.put("desc", desc==null?"":desc);
			jsonObject.put("website", website==null?"":website);
			jsonObject.put("isouter", currentUser.getIsouter());
//			Usermobileinfo mobileinfo=usermobileinfoService.getBindableMobile(currentUser.getId());
//			if(mobileinfo!=null){
//				jsonObject.put("mobilenum", mobileinfo.getMobilenum());
//				jsonObject.put("mobileisbindable", mobileinfo.getStatus());
//			}else{
//				jsonObject.put("mobilenum", "");
//			}
			JSONArray array=new JSONArray();
			for (Object object : emails) {
				UserEmail userEmail=(UserEmail) object;
				JSONObject temp=new JSONObject();
				temp.put("email", userEmail.getEmail());
				temp.put("checkstatus", userEmail.getBindable());
				temp.put("acceptstatus", userEmail.getStatus());
				temp.put("emailid", userEmail.getId());
				array.add(temp);
			}
			jsonObject.put("emails", array);
			if(address==null||address.length()<=0){
				jsonObject.put("address", "");
				jsonObject.put("sufaddress", "");
				jsonObject.put("addresscode", "");
			}else{
				if(address.indexOf(":")>0){
					String []addarr=address.split(":");
					String preaddress=addarr[0];
					String sufaddress=addarr[1];
					if(preaddress.indexOf("_")>0){
						String[]areaarr=preaddress.split("_");
						int pid=Integer.parseInt(areaarr[0]);
						String padd=UserService.getRealAddress("Province",pid);
						int cid=Integer.parseInt(areaarr[1]);
						String cadd=null;
						String dadd=null;
						if(cid==0){
							cadd="";
						}else{
							cadd=UserService.getRealAddress("City",cid);
						}
						if(areaarr.length==3){
							int did=Integer.parseInt(areaarr[2]);
							if(did==0){
								dadd="";
							}else{
								dadd=UserService.getRealAddress("District", did);
							}
						}else{
							dadd="";
						}
						jsonObject.put("address", padd+cadd+dadd+" "+sufaddress);
						jsonObject.put("sufaddress", sufaddress);
						jsonObject.put("addresscode", preaddress);
					}else{
						int pid=Integer.parseInt(preaddress);
						String padd=UserService.getRealAddress("Province",pid);
						if(padd==null){
							jsonObject.put("address", sufaddress);
							jsonObject.put("sufaddress", sufaddress);
							jsonObject.put("addresscode", "");
						}else{
							jsonObject.put("address", padd+" "+sufaddress);
							jsonObject.put("sufaddress", sufaddress);
							jsonObject.put("addresscode", preaddress);
						}
					}
					
				}else{
					jsonObject.put("address", address);
					jsonObject.put("sufaddress", address);
					jsonObject.put("addresscode", "");
				}
			}
			
		}else{
			jsonObject.put("result", 0);
			jsonObject.put("errormsg", "非法访问");
		}
		Struts2Utils.renderJson(jsonObject.toString());
	}
	
	public void updateCCInfo(){
		HttpSession session=Struts2Utils.getSession();
		User currentUser=(User) session.getAttribute(SessionAttributeKey.USER);
		currentUser.setJob(desc);
		if(sufAddress!=null&&sufAddress.length()>0){
			currentUser.setLiving(preAddress+":"+sufAddress);
		}else{
			currentUser.setLiving("");
		}
		String tempWebSite=webSite;
		if(tempWebSite!=null&&tempWebSite.length()>0&&URLUtil.verifyUrl(tempWebSite)){
			if(tempWebSite.toLowerCase().indexOf("https://")<0||tempWebSite.toLowerCase().indexOf("http://")<0){
				tempWebSite="http://"+tempWebSite;
			}
			currentUser.setBlog(tempWebSite);
		}else
			currentUser.setBlog("");
		this.userService.updateUser(currentUser);
		JSONObject jsonObject=new JSONObject();
		jsonObject.put("result", 1);
		String address=currentUser.getLiving();
		if(address==null||address.length()<=0){
			jsonObject.put("address", "");
			jsonObject.put("sufaddress", "");
			jsonObject.put("addresscode", "");
		}else{
			if(address.indexOf(":")>0){
				String []addarr=address.split(":");
				String preaddress=addarr[0];
				String sufaddress=addarr[1];
				if(preaddress.indexOf("_")>0){
					String[]areaarr=preaddress.split("_");
					int pid=Integer.parseInt(areaarr[0]);
					String padd=UserService.getRealAddress("Province",pid);
					int cid=Integer.parseInt(areaarr[1]);
					String cadd=null;
					String dadd=null;
					if(cid==0){
						cadd="";
					}else{
						cadd=UserService.getRealAddress("City",cid);
					}
					if(areaarr.length==3){
						int did=Integer.parseInt(areaarr[2]);
						if(did==0){
							dadd="";
						}else{
							dadd=UserService.getRealAddress("District", did);
						}
					}else{
						dadd="";
					}
					jsonObject.put("address", padd+cadd+dadd+" "+sufaddress);
					jsonObject.put("sufaddress", sufaddress);
					jsonObject.put("addresscode", preaddress);
				}else{
					int pid=Integer.parseInt(preaddress);
					String padd=UserService.getRealAddress("Province",pid);
					if(padd==null){
						jsonObject.put("address", sufaddress);
						jsonObject.put("sufaddress", sufaddress);
						jsonObject.put("addresscode", "");
					}else{
						jsonObject.put("address", padd+" "+sufaddress);
						jsonObject.put("sufaddress", sufaddress);
						jsonObject.put("addresscode", preaddress);
					}
					
				}
				
			}else{
				jsonObject.put("address", address);
				jsonObject.put("sufaddress", address);
				jsonObject.put("addresscode", "");
			}
		}
		
		
		Struts2Utils.renderJson(jsonObject.toString());
	}
	
	
	
	public void getCCDimensioncode(){
		User user=this.userService.getUserById(uid);
		JSONObject jsonObject=new JSONObject();
		if(user==null||user.getUsertype()!=2){
			jsonObject.put("result", 0);
			jsonObject.put("errormsg", "用户不存在");
		}else{
			String demensioncode=this.userService.getCCDemensionByUid(user.getId());
			jsonObject.put("result", 1);
			if(user.getEdu()==null||user.getEdu().length()<=0){
				jsonObject.put("hasdemension", 0);
			}else{
				jsonObject.put("hasdemension", 1);
				jsonObject.put("demensioncodeurl", demensioncode);
			}
		}
		Struts2Utils.renderJson(jsonObject.toString());
	}
	
	public void sumSubscribed(){
		HttpSession session=Struts2Utils.getSession();
		User currentUser=(User) session.getAttribute(SessionAttributeKey.USER);
		JSONObject jsonObject=new JSONObject();
		if(currentUser==null||currentUser.getUsertype()!=2){
			jsonObject.put("result", 0);
			jsonObject.put("errormsg", "用户不存在");
		}else{
			long count=this.contactService.countAllSubscribedUsers(currentUser.getId(),true);
			jsonObject.put("result", 1);
			jsonObject.put("count",count);

		}
		Struts2Utils.renderJson(jsonObject.toString());
	}
	
	public void createSinaOAuth2URL(){
		HttpServletRequest request = Struts2Utils.getRequest();
		HttpSession session = request.getSession(true);
		User user = (User)session.getAttribute(SessionAttributeKey.USER);
		boolean isneedauthorize=true;
		if(user==null){
			Cookie[] cookies=request.getCookies(); 
			if(cookies!=null){
				for(Cookie cookie: cookies){
					if(cookie.getName().equals(CookieAttributeKey.COOKIESINAUID)){
						if(cookie.getValue()!=null&&cookie.getValue().length()>1){
							String cookievalue = cookie.getValue();
							String sinauidstr=Functions.base64_decode(cookievalue);
							if(sinauidstr.indexOf(",")>0){
								String[] c = sinauidstr.split(",");
								Userassina userassina= userService.getAndUpdateUserassina(c[0], null);
								if(userassina!=null){
									User currentUser=this.userService.getUserById(userassina.getUid());
									session.setAttribute(SessionAttributeKey.USER, currentUser);
									session.setAttribute(SessionAttributeKey.USERASSINA, userassina);
									isneedauthorize=false;
								}
							}
						}
					}
				}
			}
		}else{
			isneedauthorize=false;
		}
		JSONObject jsonObject=new JSONObject();
		if(isneedauthorize){
			Oauth oauth = new Oauth();
			String url=null;
			try {
				url=oauth.authorize("code","sina",suffixurl);
			} catch (WeiboException e) {
				e.printStackTrace();
			}
			if(url==null){
				jsonObject.put("result", 0);
				jsonObject.put("errormsg", "生成授权url错误");
			}else{
				jsonObject.put("result", 1);
				jsonObject.put("status", 0);
				jsonObject.put("oauthurl", url);
			}
		}else{
			jsonObject.put("result", 1);
			jsonObject.put("status", 1);
		}
		Struts2Utils.renderJson(jsonObject.toString());
	}
	
	public void userCreateSinaOAuth2URL(){
		HttpServletRequest request = Struts2Utils.getRequest();
		HttpSession session = request.getSession(true);
		User user = (User)session.getAttribute(SessionAttributeKey.USER);
//		Userassina userassina= (Userassina)session.getAttribute(SessionAttributeKey.USERASSINA);
		JSONObject jsonObject=new JSONObject();
//		if(userassina!=null){
//			jsonObject.put("result", 0);
//			jsonObject.put("errormsg", "已经绑定新浪微博");
//			Struts2Utils.renderJson(jsonObject.toString());
//			return;
//		}
		Oauth oauth = new Oauth();
		String url=null;
		try {
			url=oauth.authorize("code","sina",suffixurl);
		} catch (WeiboException e) {
			e.printStackTrace();
		}
		if(url==null){
			jsonObject.put("result", 0);
			jsonObject.put("errormsg", "生成授权url错误");
		}else{
			jsonObject.put("result", 1);
			jsonObject.put("status", 0);
			jsonObject.put("oauthurl", url);
		}
		Struts2Utils.renderJson(jsonObject.toString());
	}
	
	public void checkSinacode(){
		Oauth oauth = new Oauth();
		JSONObject jsonObject=new JSONObject();
		try {
			AccessToken accessToken=oauth.getAccessTokenByCode(code);
			String sinauid=accessToken.getUid();
			Userassina userassina=this.userService.getAndUpdateUserassina(sinauid,accessToken);
			HttpSession httpSession=Struts2Utils.getSession();
			if(userassina==null){
				httpSession.setAttribute(SessionAttributeKey.ACCESSTOKEN, accessToken);
				jsonObject.put("result", 1);
				jsonObject.put("loginstatus", 0);
			}else{
				int uid=userassina.getUid();
				User currentUser=this.userService.getUserById(uid);
				httpSession.setAttribute(SessionAttributeKey.USER, currentUser);
				httpSession.setAttribute(SessionAttributeKey.USERASSINA, userassina);
				String cookievalue=Functions.base64_encode(accessToken.getUid()+",auto");
				
				Cookie cookie = new Cookie(CookieAttributeKey.COOKIESINAUID, cookievalue);
				cookie.setMaxAge(7*24*60*60);
				cookie.setPath("/");
				ServletActionContext.getResponse().addCookie(cookie);
				Cookie cookie2 = new Cookie(CookieAttributeKey.COOKIENAME, "");
				cookie2.setMaxAge(7*24*60*60);
				cookie2.setPath("/");
				ServletActionContext.getResponse().addCookie(cookie2);
				jsonObject.put("result", 1);
				jsonObject.put("loginstatus", 1);
				jsonObject.put("usertype", currentUser.getUsertype());
				String url=(String) httpSession.getAttribute(SessionAttributeKey.AFTERCHECKSINACODEURL);
				jsonObject.put("fwurl", url);
				httpSession.removeAttribute(SessionAttributeKey.AFTERCHECKSINACODEURL);
			}
		} catch (WeiboException e) {
			jsonObject.put("result", 0);
			jsonObject.put("errormsg", "新浪登录失败");
//			e.printStackTrace();
		}
		Struts2Utils.renderJson(jsonObject.toString());
	}
	
	public void userBindSinacode(){
		Oauth oauth = new Oauth();
		JSONObject jsonObject=new JSONObject();
		try {
			HttpSession httpSession=Struts2Utils.getSession();
			Userassina userassina=(Userassina) httpSession.getAttribute(SessionAttributeKey.USERASSINA);
			AccessToken accessToken=oauth.getAccessTokenByCode(code);
			String sinauid=accessToken.getUid();
			if(userassina==null){
				User currentUser=(User) httpSession.getAttribute(SessionAttributeKey.USER);
				userassina=this.userService.getUserassina(sinauid);
				if(userassina!=null&&userassina.getUid()!=currentUser.getId()){
					jsonObject.put("result", 0);
					jsonObject.put("errormsg", "对不起，该新浪账户被其他用户绑定。");
				}else{
					userassina=this.userService.getAndUpdateUserassina(sinauid,accessToken);
					if(userassina==null){
						userassina=this.userService.userBindSina(currentUser,accessToken);
						httpSession.setAttribute(SessionAttributeKey.USERASSINA, userassina);
						httpSession.setAttribute(SessionAttributeKey.USER, currentUser);
						jsonObject.put("result", 1);
					}else{
						
						httpSession.setAttribute(SessionAttributeKey.USERASSINA, userassina);
						jsonObject.put("result", 1);
						String url=(String) httpSession.getAttribute(SessionAttributeKey.AFTERCHECKSINACODEURL);
						jsonObject.put("trun2url", url);
					}
				}
			}else{
				
				userassina=this.userService.getAndUpdateUserassina(sinauid,accessToken);
				jsonObject.put("result", 1);
				String url=(String) httpSession.getAttribute(SessionAttributeKey.AFTERCHECKSINACODEURL);
				jsonObject.put("trun2url", url);
			}
			httpSession.removeAttribute(SessionAttributeKey.AFTERCHECKSINACODEURL);
		} catch (WeiboException e) {
			jsonObject.put("result", 0);
			jsonObject.put("errormsg", "新浪绑定失败");
//			e.printStackTrace();
		}
		Struts2Utils.renderJson(jsonObject.toString());
	}
	
	public void getSinaUserInfo(){
		HttpSession httpSession=Struts2Utils.getSession();
		AccessToken accessToken=(AccessToken) httpSession.getAttribute(SessionAttributeKey.ACCESSTOKEN);
		String accesstokenstr=accessToken.getAccessToken();
		String sinauid=accessToken.getUid();
		Users um = new Users();
		um.client.setToken(accesstokenstr);
		weibo4j.model.User sinauser=null;
		JSONObject jsonObject=new JSONObject();
		try {
			sinauser = um.showUserById(sinauid);
		} catch (WeiboException e) {
			e.printStackTrace();
		}
		if(sinauser==null){
			jsonObject.put("result", 0);
			jsonObject.put("errormsg", "获取用户信息错误");
			Struts2Utils.renderJson(jsonObject.toString());
			return;
		}
		jsonObject.put("result", 1);
		String avatarLargeurl=sinauser.getAvatarLarge();//大头像地址
		String name=sinauser.getScreenName();//微博昵称
		jsonObject.put("avatarLargeurl",avatarLargeurl);
		jsonObject.put("name",name);
		int sinaprovinceid=sinauser.getProvince();
		int sinacityid=sinauser.getCity();
		Province province=new Province();
		String filepath=province.getProvinceFilepath();
		SAXBuilder builder=new SAXBuilder(false);
		int pid=0,ptype=0,cid=0,did=0;
		try {
			Document document=builder.build(filepath);   
			Element es=document.getRootElement();
			List rowlist=es.getChildren("row");
			for(int i=0;i<rowlist.size();i++){
				JSONObject temp=new JSONObject();
				Element element=(Element) rowlist.get(i);
				Integer tempsinaid=Integer.parseInt(element.getChildText(Province.SINAID));
				if(tempsinaid==sinaprovinceid){
					pid=Integer.parseInt(element.getChildText(Province.ID));
					ptype=Integer.parseInt(element.getChildText(Province.TYPE));
					
					break;
				}
			}
		} catch (JDOMException e) {
			e.printStackTrace();
		} catch (IOException e) {
			e.printStackTrace();
		}
		String addresscode=null;
		if(pid==0){
			addresscode="0";
		}else{
			if(ptype==-1){
				District district=new District();
				try {
					Document document=builder.build(district.getDistrictFilepath());   
					Element es=document.getRootElement();
					List rowlist=es.getChildren("row");
					for(int i=0;i<rowlist.size();i++){
						JSONObject temp=new JSONObject();
						Element element=(Element) rowlist.get(i);
						Integer tempsinaid=Integer.parseInt(element.getChildText(District.SINAID));
						int tempppid=Integer.parseInt(element.getChildText(District.PPID));
						if(tempsinaid==sinacityid&&pid==tempppid){
							did=Integer.parseInt(element.getChildText(District.ID));
							break;
						}
					}
				} catch (JDOMException e) {
					e.printStackTrace();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if(did==0){
					addresscode=""+pid;
				}else{
					addresscode=pid+"_0_"+did;
				}
			}else{
				City city=new City();
				try {
					Document document=builder.build(city.getCityFilepath());   
					Element es=document.getRootElement();
					List rowlist=es.getChildren("row");
					for(int i=0;i<rowlist.size();i++){
						JSONObject temp=new JSONObject();
						Element element=(Element) rowlist.get(i);
						Integer tempsinaid=Integer.parseInt(element.getChildText(City.SINAID));
						int temppid=Integer.parseInt(element.getChildText(City.PID));
						if(tempsinaid==sinacityid&&temppid==pid){
							cid=Integer.parseInt(element.getChildText(City.ID));
							break;
						}
					}
				} catch (JDOMException e) {
					e.printStackTrace();
				} catch (IOException e) {
					e.printStackTrace();
				}
				if(cid==0){
					addresscode=""+pid;
				}else{
					addresscode=pid+"_"+cid;
				}
			}
		}
		jsonObject.put("addresscode",addresscode);
		Struts2Utils.renderJson(jsonObject.toString());
	}
	
	public void sinaregister(){
		HttpSession httpSession=Struts2Utils.getSession();
		AccessToken accessToken=(AccessToken) httpSession.getAttribute(SessionAttributeKey.ACCESSTOKEN);
		User user=this.userService.sinaRegister(accessToken, nameInput, sinaheadurl, sexInput, birthdayInput, preAddress,sufAddress);
		JSONObject jsonObject=new JSONObject();
		if(user!=null){
			httpSession.setAttribute(SessionAttributeKey.USER, user);
			httpSession.removeAttribute(SessionAttributeKey.ACCESSTOKEN);
			String cookievalue=Functions.base64_encode(accessToken.getUid());
			Cookie cookie = new Cookie(CookieAttributeKey.COOKIESINAUID, cookievalue);
			cookie.setMaxAge(7*24*60*60);
			cookie.setPath("/");
			ServletActionContext.getResponse().addCookie(cookie);
			String url=(String) httpSession.getAttribute(SessionAttributeKey.AFTERCHECKSINACODEURL);
			jsonObject.put("result", 1);
			jsonObject.put("fwurl", url);
			httpSession.removeAttribute(SessionAttributeKey.AFTERCHECKSINACODEURL);
		}else{
			jsonObject.put("result", 0);
			jsonObject.put("errormsg", "注册用户失败");
		}
		Struts2Utils.renderJson(jsonObject.toString());
	}
	
	public void unbindUserSina(){
		HttpSession httpSession=Struts2Utils.getSession();
		User currentUser=(User) httpSession.getAttribute(SessionAttributeKey.USER);
		Userassina userassina=(Userassina) httpSession.getAttribute(SessionAttributeKey.USERASSINA);
		this.userService.unbindUserSina(currentUser,userassina);
		httpSession.setAttribute(SessionAttributeKey.USER, currentUser);
		httpSession.removeAttribute(SessionAttributeKey.USERASSINA);
		JSONObject jsonObject=new JSONObject();
		jsonObject.put("result", 1);
		Struts2Utils.renderJson(jsonObject.toString());
	}
	
	public void checkIshasAsync(){
		HttpSession httpSession=Struts2Utils.getSession();
		User currentUser=(User) httpSession.getAttribute(SessionAttributeKey.USER);
		JSONObject jsonObject=new JSONObject();
		Userassina userassina=this.userService.getUserSinatoken(currentUser.getId());
		if(userassina==null){
			jsonObject.put("result", 0);
		}else{
			httpSession.setAttribute(SessionAttributeKey.USERASSINA,userassina);
			Calendar now=Calendar.getInstance();
			Calendar accesstime=Calendar.getInstance();
			accesstime.setTimeInMillis(	userassina.getAccesstime());
			accesstime.add(Calendar.SECOND, new Long(userassina.getExpirein()).intValue());
			accesstime.add(Calendar.MINUTE, 30);
			if(accesstime.getTimeInMillis()<now.getTimeInMillis()){
				jsonObject.put("result", -1);
				httpSession.setAttribute(SessionAttributeKey.AFTERCHECKSINACODEURL, suffixurl);
			}else
				jsonObject.put("result", 1);
		}

		Struts2Utils.renderJson(jsonObject.toString());
	}
	
	public void saveCurrentHref(){
		HttpSession httpSession=Struts2Utils.getSession();
		httpSession.setAttribute(SessionAttributeKey.AFTERCHECKSINACODEURL, this.suffixurl);
	}
	
	public String getEmailInput() {
		return emailInput;
	}
	public void setEmailInput(String emailInput) {
		this.emailInput = emailInput;
	}
	public String getPwdInput() {
		return pwdInput;
	}
	public void setPwdInput(String pwdInput) {
		this.pwdInput = pwdInput;
	}
	public String getPwdInput2() {
		return pwdInput2;
	}
	public void setPwdInput2(String pwdInput2) {
		this.pwdInput2 = pwdInput2;
	}
	public String getNameInput() {
		return nameInput;
	}

	public void setNameInput(String nameInput) {
		this.nameInput = nameInput;
	}

	public String getVcodeInput() {
		return vcodeInput;
	}

	public void setVcodeInput(String vcodeInput) {
		this.vcodeInput = vcodeInput;
	}

	public String getActivate() {
		return activate;
	}

	public void setActivate(String activate) {
		this.activate = activate;
	}
	public String getMobilenum() {
		return mobilenum;
	}
	public void setMobilenum(String mobilenum) {
		this.mobilenum = mobilenum;
	}
	public String getCodenum() {
		return codenum;
	}
	public void setCodenum(String codenum) {
		this.codenum = codenum;
	}
	public int getUid() {
		return uid;
	}
	public void setUid(int uid) {
		this.uid = uid;
	}
	public int getUsertype() {
		return usertype;
	}
	public void setUsertype(int usertype) {
		this.usertype = usertype;
	}
	public int getCurrentpage() {
		return currentpage;
	}
	public void setCurrentpage(int currentpage) {
		this.currentpage = currentpage;
	}
	public int getEventid() {
		return eventid;
	}
	public void setEventid(int eventid) {
		this.eventid = eventid;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public int getSexInput() {
		return sexInput;
	}
	public void setSexInput(int sexInput) {
		this.sexInput = sexInput;
	}
	public long getBirthdayInput() {
		return birthdayInput;
	}
	public void setBirthdayInput(long birthdayInput) {
		this.birthdayInput = birthdayInput;
	}
	public int getProvinceid() {
		return provinceid;
	}
	public void setProvinceid(int provinceid) {
		this.provinceid = provinceid;
	}
	public int getType() {
		return type;
	}
	public void setType(int type) {
		this.type = type;
	}
	public int getCityid() {
		return cityid;
	}
	public void setCityid(int cityid) {
		this.cityid = cityid;
	}
	public String getPreAddress() {
		return preAddress;
	}
	public void setPreAddress(String preAddress) {
		this.preAddress = preAddress;
	}
	public String getSufAddress() {
		return sufAddress;
	}
	public void setSufAddress(String sufAddress) {
		this.sufAddress = sufAddress;
	}
	public String getWebSite() {
		return webSite;
	}
	public void setWebSite(String webSite) {
		this.webSite = webSite;
	}
	public String getUsernameInput() {
		return usernameInput;
	}
	public void setUsernameInput(String usernameInput) {
		this.usernameInput = usernameInput;
	}
	public File getCcdemisionfile() {
		return ccdemisionfile;
	}
	public void setCcdemisionfile(File ccdemisionfile) {
		this.ccdemisionfile = ccdemisionfile;
	}
	public String getCcdemisionfileFileName() {
		return ccdemisionfileFileName;
	}
	public void setCcdemisionfileFileName(String ccdemisionfileFileName) {
		this.ccdemisionfileFileName = ccdemisionfileFileName;
	}
	public String getDesc() {
		return desc;
	}
	public void setDesc(String desc) {
		this.desc = desc;
	}
	public String getSinaheadurl() {
		return sinaheadurl;
	}
	public void setSinaheadurl(String sinaheadurl) {
		this.sinaheadurl = sinaheadurl;
	}
	public String getSuffixurl() {
		return suffixurl;
	}
	public void setSuffixurl(String suffixurl) {
		this.suffixurl = suffixurl;
	}
	public int getEmailsubscribeid() {
		return emailsubscribeid;
	}
	public void setEmailsubscribeid(int emailsubscribeid) {
		this.emailsubscribeid = emailsubscribeid;
	}
	
	
}
